<UserControl
  x:Class="ViewOnAddInsAPI.Helper.WPF.DesktopIcon"
  xmlns:wpf="clr-namespace:ViewOnAddInsAPI.Helper.WPF"
  xmlns:host="clr-namespace:ViewOnAddInsAPI.HostContract"
  xmlns:properties="clr-namespace:ViewOnAddInsAPI.Properties"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

	<UserControl.Resources>

		<!-- Show / Hide -->
		<Storyboard x:Key="ShowDesktopIcon">
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeySpline="0.5,0.5,0.625,1" KeyTime="00:00:00.3330000" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.Visibility)">
				<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
			</ObjectAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="griMain" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
				<SplineDoubleKeyFrame KeySpline="0.5,0.5,0.625,1" KeyTime="00:00:00.3330000" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="griMain" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
				<SplineDoubleKeyFrame KeySpline="0.5,0.5,0.625,1" KeyTime="00:00:00.3330000" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>

		<!-- Select / Unselect -->
		<Storyboard x:Key="stoShowSelection">
			<DoubleAnimation To="0.8" Duration="00:00:00.4000000" Storyboard.TargetName="borSelection" Storyboard.TargetProperty="Opacity" />
		</Storyboard>
		<Storyboard x:Key="stoHideSelection">
			<DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetName="borSelection" Storyboard.TargetProperty="Opacity" />
		</Storyboard>

		<!-- Context menu -->
		<ContextMenu x:Key="DesktopIconContextMenu">
			<MenuItem Header="{x:Static properties:Globalization.DesktopIcon_ContextMenu_RemoveSelection}"/>
		</ContextMenu>
	</UserControl.Resources>

	<Grid x:Name="griMain" RenderTransformOrigin="0.5,0.5">

		<Grid.RenderTransform>
			<TransformGroup>
				<ScaleTransform ScaleX="0.8" ScaleY="0.8"/>
				<SkewTransform AngleX="0" AngleY="0"/>
				<RotateTransform Angle="0"/>
				<TranslateTransform X="0" Y="0"/>
			</TransformGroup>
		</Grid.RenderTransform>

		<Grid.RowDefinitions>
			<RowDefinition Height="34"/>
			<RowDefinition Height="24"/>
		</Grid.RowDefinitions>

		<Grid.Triggers>
			<EventTrigger RoutedEvent="Mouse.MouseEnter">
				<BeginStoryboard>
					<Storyboard>
						<Storyboard.Children>
							<!--DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetName="GlowEffect" Storyboard.TargetProperty="Opacity" /-->
							<DoubleAnimation To="0.7" Duration="00:00:00.4000000" Storyboard.TargetName="GlowEffect2" Storyboard.TargetProperty="Opacity" />
							<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgDesktopIcon" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
								<SplineDoubleKeyFrame KeyTime="00:00:00.15" Value="1.10"/>
							</DoubleAnimationUsingKeyFrames>
							<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgDesktopIcon" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
								<SplineDoubleKeyFrame KeyTime="00:00:00.15" Value="1.10"/>
							</DoubleAnimationUsingKeyFrames>
							<Int32AnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgDesktopIcon" Storyboard.TargetProperty="(Panel.ZIndex)">
								<SplineInt32KeyFrame KeyTime="00:00:00" Value="49"/>
								<SplineInt32KeyFrame KeyTime="00:00:00.1500000" Value="48"/>
							</Int32AnimationUsingKeyFrames>
						</Storyboard.Children>
					</Storyboard>
				</BeginStoryboard>
			</EventTrigger>
			<EventTrigger RoutedEvent="Mouse.MouseLeave">
				<BeginStoryboard>
					<Storyboard>
						<Storyboard.Children>
							<!--DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetName="GlowEffect" Storyboard.TargetProperty="Opacity" /-->
							<DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetName="GlowEffect2" Storyboard.TargetProperty="Opacity" />
							<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgDesktopIcon" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
								<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.10"/>
								<SplineDoubleKeyFrame KeyTime="00:00:00.15" Value="1"/>
							</DoubleAnimationUsingKeyFrames>
							<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgDesktopIcon" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
								<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.10"/>
								<SplineDoubleKeyFrame KeyTime="00:00:00.15" Value="1"/>
							</DoubleAnimationUsingKeyFrames>
							<Int32AnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgDesktopIcon" Storyboard.TargetProperty="(Panel.ZIndex)">
								<SplineInt32KeyFrame KeyTime="00:00:00" Value="1"/>
								<SplineInt32KeyFrame KeyTime="00:00:00.1500000" Value="0"/>
							</Int32AnimationUsingKeyFrames>
						</Storyboard.Children>
					</Storyboard>
				</BeginStoryboard>
			</EventTrigger>
		</Grid.Triggers>

		<Border x:Name="borSelection" Background="{DynamicResource VOColor02}" CornerRadius="2" Grid.RowSpan="2" Opacity="0" Margin="2,2,2,2"/>

		<wpf:Icon x:Name="imgDesktopIcon" Source="/_images/Generic/folder.png" Width="32" Height="32" Margin="4,4,4,4" RenderTransformOrigin="0.5,0.5">
			<wpf:Icon.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="0"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</wpf:Icon.RenderTransform>
		</wpf:Icon>

		<TextBlock x:Name="txtTitle" Grid.Row="1"  HorizontalAlignment="Center" Margin="2,0,2,2">
			<TextBlock.BitmapEffect>
				<OuterGlowBitmapEffect x:Name="GlowEffect2" GlowColor="{Binding Source={x:Static host:Host.UIService}, Path=GlowColors.VOGColor1A}" GlowSize="2" Noise="0" Opacity="0"/>
			</TextBlock.BitmapEffect>
		</TextBlock>

	</Grid>
</UserControl>
